﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SingleFileUpload.Providers
{
	public class FileStateConverter : System.Windows.Data.IValueConverter
	{

		#region IValueConverter Members

		public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			Constants.FileStates thistate = (Constants.FileStates)value;

			string state = string.Empty;
			switch (thistate)
			{
				case Constants.FileStates.Pending:
					state = "等待上传";
					break;
				case Constants.FileStates.Finished:
					state = "已上传";
					break;
				case Constants.FileStates.Error:
					state = "错误";
					break;
				case Constants.FileStates.Uploading:
					state = "上传中";
					break;
				case Constants.FileStates.Deleted:
					state = "已删除";
					break;
				case Constants.FileStates.Pause:
					state = "暂停";
					break;
				case Constants.FileStates.Continue:
					state = "继续上传";
					break;
			}
			// Return the value to pass to the target.
			return state;
		}

		// ConvertBack is not implemented for a OneWay binding.
		public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			throw new System.NotImplementedException();
		}

		#endregion
	}
}
